export default function () {
    var Liquid = window.liquidjs.Liquid;
    const engine = new Liquid({
        extname: ".html",
        cache: true,
        globals: {
            theme_config: window.themeConfig || {}
        }
    });

    /* 国家 */
    engine.registerFilter("current_countrys", (item, key) => {
        if (!item) {
            return `${oemcart_imgcdn}/statics/country/flag/default.png`;
        } else {
            const file = oemcart_countrys[item].country_code_2.toLowerCase();
            return `${oemcart_imgcdn}/statics/country/flag/${file}.png`;
        }
    });
    /* 货币过滤器 */
    engine.registerFilter("money", (item, key) => {
        return formatMoney(parseFloat(item || 0), window.oemcart_currency);
    });
    /* 绝对路径过滤器 */
    engine.registerFilter("public_asset_abs_dir_url", (item, key) => {
        return "/theme/default/assets/" + item;
    });

    window["engine"] = engine;
}
